package com.ebelter.myehc.beans;


import com.ebelter.btcomlib.models.bluetooth.products.bracelet.bean.RateBean;

import java.util.ArrayList;
import java.util.List;

public class OneDayChartViewDataBean {


    public OneDayChartViewDataBean() {
        this.list = new ArrayList<>();
    }

    public List<OneDayChartViewDataBean_In> list;

    public int maxXl;
    public int minXl;
    public int avgXl;

    public float newestXl;

    public static class OneDayChartViewDataBean_In{
        public OneDayChartViewDataBean_In() {
            this.rateOneDayInfos = new ArrayList<>();
        }

        public boolean isDrawButtomTitle;
        public String t1;
        public String t2;
        public String t3;

        public void setDrawButtomTitle(boolean drawButtomTitle,String t1,String t2,String t3) {
            this.isDrawButtomTitle = drawButtomTitle;
            this.t1=t1;
            this.t2=t2;
            this.t3=t3;
        }


        public int startY;
        public int endY;

        public List<RateBean> rateOneDayInfos;


        public void calculateStartEndY(){
            if (rateOneDayInfos!=null&&rateOneDayInfos.size()>0){
                startY=rateOneDayInfos.get(0).rate;
                endY=rateOneDayInfos.get(0).rate;
                for (RateBean rateBean:rateOneDayInfos){
                    if (rateBean.rate<startY){
                        startY=rateBean.rate;
                    }
                    if (rateBean.rate>endY){
                        endY=rateBean.rate;
                    }
                }

                startY=startY-5;
                endY=endY+5;
                if (startY<0)startY=0;
            }
        }


    }
}
